<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Perfect Home Page</title>
<link href="mailto:goldenv@gmail.com" rev="1.0" />

<script type="text/javascript">
<!--//--><![CDATA[//><!--

// Copyright 2005-2008 Vishal Shah (goldenv@gmail.com)
// This source file is licensed per Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
// Project home pages: 
// http://projects.vishalshah.org/tphp for general info
// http://code.google.com/p/tphp/ for source, wiki and future directions

// Refactoring Note:
// This project was worked in circa 2004. And I was learning JavaScript at the time.
// Hence some modern JavaScript refactoring is to follow, but not to say this code is not perfomant or efficient.
// It runs pretty well on most browsers under most environments

// =================  USER CONTROL PANEL =====================

// NOTE: Anything following 2 forward slashes "//" is a comment and ignored for processing.
// Feel free to explore. A backup copy will be available at the web site,
// in case you want to revert back.

// This is the escape code, which notifies that a special code follows like -book.
// Change the "-" part below to anything you like. Example: "/"
// Then for searching books you will need to type: /books Life of Pi
// instead of: -books Life of Pi
// Keep it to something that is not part of usual queries.
// It **CANNOT** be multi-character wide, like "//".
var SWITCH_CODE = "-";

// Lucky code *MUST* be two-character wide. It is the symbol you type after the your search query to go to Google's first result.
var LUCKY_CODE = ">>";

// Set this to false if you don't like the random background colors generated around the box. Example below:
// var randomBackgrounds = false;
// Note: No quotes " around true or false. Now you choose what should be the default background color you want.
// If the randomBackgrounds is true, setting a default background color has no effect.
var randomBackgrounds = true;
var myBoxBackgroundColor = "#FFFFFF";   // this is white. Find more colors at http://www.htmlgoodies.com/tutors/colors.html

// You can even have background colors for the entire page! Set it to some color.
// Find more colors at http://www.htmlgoodies.com/tutors/colors.html
// Example:
// var myBackgroundPageColor = "#F0F8FF";
var myBackgroundPageColor = "";

// Or, you can even have a picture as the background of the page. Keep it in the same
// directory as this file, and copy it's name below. It could be a jpeg/jpg, gif, png...
// var myBackgroundPageImage = "myBackground.jpg";
// Just copy the file name below and done. Refresh the page to see in effect.
var myBackgroundPageImage = "";

// No. of entries to display in history
var NUM_HISTORY_ITEMS_TO_DISPLAY = 0;   // Set this to 0 for no limits.

// No. of entries to display in recommendations display (if that many available)
var NUM_SUGGESTIONS_TO_DISPLAY = 10;

var COOKIE_NAME = "_TPHP_";
var COOKIE_ENTRY_SEP = "__@@__";
var ENTRY_DATE_SEP = "\\//";

// ======================================================================
// =============== END CONTROL PANEL. CODE FOLLOWS ======================
// ======================================================================

// Non - customizable variables
var bookmarksRegistry = new Array("dtb", "dttv", "dtm", "cnn", "ifm", "boxoffice", "topmovies", "awad", "news");
var HISTORY_DISPLAYED = false;
var RECOMMENDATIONS_DISPLAYED = false;
var BOOKMARKS_DISPLAYED = false;

function welcomeBack() {
	if(randomBackgrounds) {
		var colors = new Array("#F0F8FF", "#FAEBD7", "#7FFFD4","#FFFFCC","#CCFFCC", "#F0F0F0", "#D8D8D8", "#D0D0D0", "#CCFF33", "#F8F8F8", "#CCFFFF", "#CCFFCC", "#E8E8E8", "#CCFF99", "#CCFF66", "#CCFF33", "#CCFF00", "#FFFF99", "#CCCCFF", "#FFCCFF", "#F0F8FF", "#F0FFFF", "#F5F5DC", "#FAEBD7", "#FFFAF0", "#F8F8FF", "#FFF8DC", "#FFEBCD", "#FFF8DC", "#F0FFF0", "#FFFFF0", "#FFF0F5", "#F0E68C", "#E6E6FA", "#FFFACD", "#E0FFFF", "#FAF0E6", "#F5FFFA", "#FFE4E1", "#FDF5E6", "#EEE8AA", "#FFEFD5", "#FFDAB9", "#B0E0E6", "#EEE8AA", "#FFFAFA", "#D8BFD8", "#F5DEB3", "#FFFFFF", "#F5F5F5", "#DEB887", "#A9A9A9", "#BDB76B", "#D0D0D0", "#DCDCDC", "#ADD8E6", "#90EE90", "#D3D3D3", "#E0E0E0", "#D2B48C");
		// var num = Math.round(Math.random() * (colors.length - 1));
		var num = Math.floor(Math.random() * colors.length);
		document.getElementById("CenterBox").style.background = colors[num];
	}
	else {
		document.getElementById("CenterBox").style.background = myBoxBackgroundColor;
	}
	if(myBackgroundPageColor.length > 0) {
		document.body.bgColor = myBackgroundPageColor;
	}
	else if(myBackgroundPageImage.length > 0) {
		document.body.background = myBackgroundPageImage;
	}
	toggleRecommendations();   // will display them first, if thet aren not yet
	getWelcomeString();
	focusSearchBox();	   // place cursor in text box for the user to start typing
	return;
}

function getHistory() {
	var toReturn = null;
	var tphpCk = getCookie(COOKIE_NAME);
	if(tphpCk != null && tphpCk != "null" && tphpCk != "NaN") {  // firefox returns Nan
		toReturn = tphpCk.split(COOKIE_ENTRY_SEP);
	}
	return toReturn;
}

// set yearFlag to true to return a terse (shorter) format without the year being displayed
function getTodaysDate(shorterFormat) {
	var today = new Date();
	var date = null;
	if(shorterFormat == true) {
		var weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
		date = (today.getMonth() + 1) + "/" + today.getDate() + "&nbsp;" + weekday[today.getDay()];
	}
	else {
		var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday!","Saturday!");
		date = weekday[today.getDay()] + "&nbsp;" + (today.getMonth() + 1) + "/" + today.getDate() + "/" + today.getFullYear();
	}
	return date;
}

function getWelcomeString() {
	var desc = getTodaysDate(false);   // setting shorterFormat to false will return today's date in full format
	document.getElementById("ServiceDescription").innerHTML = desc;
	return desc;
}

function reloadBrowser() {
	window.location.reload();
}

function displayRecentMessage(msg) {
	var recentMsgSpace = document.getElementById("RecentMessagesSpace");
	recentMsgSpace.style.visibility = "visible";
	recentMsgSpace.style.display = "block";
	recentMsgSpace.innerHTML = "<div class=\"TopRightCorner\"><a title=\"Hide Message Space\" href=\"#\" onclick=\"hideRecentMessageSpace()\">Hide</a></div>" + msg;
	focusSearchBox();
	return;
}

function hideRecentMessageSpace() {
	var recentMsgSpace = document.getElementById("RecentMessagesSpace");
	recentMsgSpace.style.visibility = "hidden";
	recentMsgSpace.style.display = "none";
	recentMsgSpace.innerHTML = "";
	focusSearchBox();
	return;
}

function useThisQuery(selectedQuery, fromHistory, fromBookmarks, redirect) {
	document.getElementById("SearchBox").value = unescape(selectedQuery);
	if(fromHistory != null && fromHistory == true) {
		toggleHistory();   // hide
	}
	if(fromBookmarks != null && fromBookmarks == true) {
		toggleBookmarks();   // hide
	}
	focusSearchBox();
	if(redirect != null && redirect == true) {
		processInput(true);
	}
	else {
		processInput(false);
	}
	return;
}

function focusSearchBox() {
	document.getElementById("SearchBox").focus();
	return;
}


function getCookieExpDate(expireNow) {
	var expDate = new Date();
	if(expireNow == false) {
		var fiveYears = 5 * 365 * 24 * 60 * 60 * 1000;
		expDate.setTime(expDate.getTime() + fiveYears );
	}
	else {
		var sevenDays = 7 * 24 * 60 * 60 * 1000;
		expDate.setTime (expDate.getTime() - sevenDays);
	}
	return ("; expires=" + expDate.toGMTString());
}

// Cookie Format: [entry 1][separator][entry2][separator][entry 3] ...
function setCookie(value, expireNow) {
	var flag = false;
	if(expireNow == false && value != null && value != "") {
		var ck = getCookie();
		if(ck == null) {
			ck = value;
		}
		else {
			// check if it is a duplicate entry on the SAME DATE
			var items = ck.split(COOKIE_ENTRY_SEP);
			var descDateEntry1 = value.split(ENTRY_DATE_SEP);
			for(var i = 0; i < items.length; ++i) {
				var descDateEntry2 = items[i].split(ENTRY_DATE_SEP);
				// if the both the entry and date are same...
				if((descDateEntry1[0].toLowerCase() == descDateEntry2[0].toLowerCase()) && (descDateEntry1[1] == descDateEntry2[1])) {
					flag = true;
					break;
				}
			 }
			// append the cookie entry separator ONLY IF the same entry does not exist on the same day
			if(! flag) {
				ck += COOKIE_ENTRY_SEP + value;
			}
		}
		document.cookie = COOKIE_NAME + "=" + escape(ck) + getCookieExpDate(false);
	}
	else {
		document.cookie = COOKIE_NAME + "= " + getCookieExpDate(true);
	}
	return;
}

// This function is adapted from Javascript Unleashed, 4th Edition - Sams Publishing
function getCookie() {
	var result = null;
	var myCookie = " " + document.cookie + ";";
	var searchName = " " + COOKIE_NAME + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if(startOfCookie != -1) {
		startOfCookie += searchName.length;
		// skip past cookie name
		endOfCookie = myCookie.indexOf(";", startOfCookie);
		result = unescape(myCookie.substring(startOfCookie,endOfCookie));
	}
	return result;
}

// Note: This function removes all (including duplicates) entries for a particular entry
function removeCookieEntry(toRemove, manualDecision, fromHistory) {
	var cookie = getCookie();
	var entries = cookie.split(COOKIE_ENTRY_SEP);
	var tempCookie = "";
	for(var i = 0; i < entries.length; ++i) {
		var cookieStr = entries[i].split(ENTRY_DATE_SEP)[0];
		if(unescape(cookieStr.toLowerCase()) != unescape(toRemove.toLowerCase())) {
			tempCookie += entries[i] + COOKIE_ENTRY_SEP;
		}
	}
	// remove trailing COOKIE_ENTRY_SEP in tempCookie
	tempCookie = tempCookie.substring(0, tempCookie.length - COOKIE_ENTRY_SEP.length);
	setCookie("", true);   // clear old entry
	setCookie(tempCookie, false);   // set new entry

	// window.location.reload();
	if(manualDecision) {   // only delete message, if it was a manual decision. Auto decisions exist when, a duplicate entry is entered and the older entries are replaced
		if(fromHistory) {
			toggleHistory();
		}
		displayRecentMessage("Successfully Deleted: <b>" + unescape(toRemove) + "</b><br/><i><b><a title=\"Reload browser window\" href=\"#\" onclick=\"reloadBrowser()\">Reload</a></b> the browser window to see the changes.</i>");
	}
	return;
}

function displayBookmarks() {
	var content = document.getElementById("Bookmarks");
	if(bookmarksRegistry == null) {
		content.innerHTML = "No bookmarks present.";
		return;
	}

	if(bookmarksRegistry.length > 0) {
		content.innerHTML += "<div class=\"LightGrayBG\"></div>";
	}
	var bGColorClasses = new Array("WhiteBG", "AlternateColorBG");
	var currentColorIndex = 0;
	for(var i = 0; i < bookmarksRegistry.length; ++i) {
		if(i % 2 == 0) {
			currentColorIndex = 0;
		}
		else {
			currentColorIndex = 1;
		}
		content.innerHTML += "<div class=\"" + bGColorClasses[currentColorIndex] + "\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + SWITCH_CODE + bookmarksRegistry[i] + "\', false, true, true)\">" + unescape(bookmarksRegistry[i]) + "</a></div>";
		currentColorIndex = currentColorIndex == 0 ? 1 : 0;
	}
	return;
}

function displayHistory(historyLinks) {
	var content = document.getElementById("History");
	if(historyLinks == null) {
		content.innerHTML = "No history has been recorded yet. <br/><br/><i>Start using TPHP to gather history links. They will also contribute to your personalized recommendations!</i>";
	}
	else {
		if(historyLinks.length > 0) {
			content.innerHTML = "<div class=\"TopRightCorner\" id=\"TopRightCorner\"><a title=\"History in RSS 2.0 format\" href=\"#\" onclick=\"generateRSS('History')\">RSS 2.0</a> | <a id=\"ClearAll\" title=\"Clear History\" href=\"#\" onclick='clearCookies()'>Clear</a></div>";
			content.innerHTML += "<div class=\"LightGrayBG\"></div>";
		}
		var maxDisplaySize = 0;
		if(NUM_HISTORY_ITEMS_TO_DISPLAY <= 0) {   // no limits to display
			maxDisplaySize = historyLinks.length;
		}
		else {
			maxDisplaySize = (historyLinks.length < NUM_HISTORY_ITEMS_TO_DISPLAY) ? historyLinks.length : NUM_HISTORY_ITEMS_TO_DISPLAY;
		}
		var lastDate = "";
		var bGColorClasses = new Array("WhiteBG", "AlternateColorBG");
		var currentColorIndex = 0;
		for(var i = 0; i < maxDisplaySize; ++i) {
			var entryTerms = historyLinks[i].split(ENTRY_DATE_SEP);
			if(entryTerms[1] != lastDate) {
				lastDate = entryTerms[1];
				content.innerHTML += (i != 0) ? "<div class=\"Rule\"></div>" : "";    // ignore a blank line on the first header
				content.innerHTML += "<span class=\"DateHeader\">" +  entryTerms[1] + "</span>";
				currentColorIndex = 1;
			}
			content.innerHTML += "<div class=\"" + bGColorClasses[currentColorIndex] + "\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + entryTerms[0] + "\', true, false, true)\">" + unescape(entryTerms[0]) + "</a> &laquo;<a class=\"GreenFont\" title=\"Pick this query to edit\" href=\"#\" onclick=\"useThisQuery(\'" + entryTerms[0] + "\', true, false, false)\">e</a>, <a class=\"RedFont\" title=\"Delete ALL occurences of this query\" href=\"#\" onclick=\"removeCookieEntry(\'" + entryTerms[0] + "\', true, true)\">d</a>&raquo;</div>";
			currentColorIndex = currentColorIndex == 0 ? 1 : 0;
			entryTerms = null;   // garbage collected
		}
	}
	return;
}

function generateRSS(entryType) {
	var entries = null;
	if (entryType == "History") {
		entries = getHistory() ;
	}
	else if (entryType == "Recommendations") {
		entries = generateRecommendations(getHistory(), "");
	}
	else {
		return;
	}
	var rss = "";
	var LESS_THAN = "&lt;", GREATER_THAN = "&gt;";
	if(entries == null) {
		rss = "No history has been recorded yet. <br/><br/><i>Start using to gather history links. They will also contribute to your personalized recommendations!</i>";
	}
	else {
		if(entries.length > 0) {
			rss = "<html><body><pre>";
			rss += LESS_THAN + "?xml version=\"1.0\"?" + GREATER_THAN + "<br/>";
			rss += LESS_THAN + "rss version=\"2.0\"" + GREATER_THAN + "<br/>";
			rss += "   " + LESS_THAN + "channel" + GREATER_THAN + "<br/>"
			rss += "      " + LESS_THAN + "title" + GREATER_THAN + "My History - The Perfect Home Page&lt;/title" + GREATER_THAN + "<br/>";
			rss += "      " + LESS_THAN + "link" + GREATER_THAN + "" + window.location.href + LESS_THAN + "/link" + GREATER_THAN + "<br/>";
			rss += "      " + LESS_THAN + "description" + GREATER_THAN + "All entries in my history" + LESS_THAN + "/description" + GREATER_THAN + "<br/>";
			rss += "      " + LESS_THAN + "language" + GREATER_THAN + "en-us" + LESS_THAN + "/language" + GREATER_THAN + "<br/>";
			var today = new Date();
			rss += "      " + LESS_THAN + "pubDate" + GREATER_THAN + "" + today.toUTCString() + LESS_THAN + "/pubDate" + GREATER_THAN + "<br/>";
			rss += "      " + LESS_THAN + "docs" + GREATER_THAN + "http://blogs.law.harvard.edu/tech/rss" + LESS_THAN + "/docs" + GREATER_THAN + "<br/>";
			rss += "      " + LESS_THAN + "generator" + GREATER_THAN + "The Perfect Home Page - http://vishalshah.org" + LESS_THAN + "/generator" + GREATER_THAN + "<br/>";

			for(var i = 0; i < entries.length; ++i) {
				var entryTerms = entries[i].split(ENTRY_DATE_SEP);
				var resultingURL = "";
				rss += "      " + LESS_THAN + "item" + GREATER_THAN + "<br/>";
				rss += "         " + LESS_THAN + "title" + GREATER_THAN + unescape(entryTerms[0]) + LESS_THAN + "/title" + GREATER_THAN + "<br/>";

				var urlAndDesc = generateUrlAndDescFromInput(unescape(entryTerms[0]));
				urlAndDesc[0] = urlAndDesc[0].replace(/&/g, "&amp;amp;");   // important to convert &'s to its entity reference to avoid XML parser errors
				rss += "         " + LESS_THAN + "link" + GREATER_THAN + urlAndDesc[0] + LESS_THAN + "/link" + GREATER_THAN + "<br/>";

				rss += "         " + LESS_THAN + "description" + GREATER_THAN + urlAndDesc[1] + LESS_THAN + "/description" + GREATER_THAN + "<br/>";
				rss += "      " + LESS_THAN + "/item" + GREATER_THAN + "<br/>";
				entryTerms = null;   // garbage collected
			}

			rss += "   " + LESS_THAN + "/channel" + GREATER_THAN + "<br/>"
			rss += LESS_THAN + "/rss>";
			rss += "</pre></body></html>";
		}
	}
	var newWindow = window.open("", "", "scrollbars=yes,width=600,height=600,resizable=yes");
	newWindow.document.write(rss);
	newWindow.alert("Done. Select All and Right-Click to copy the RSS 2.0 (XML) Feed. You can then, paste in a text editor and save the file as some-name.xml");
	return rss;
}

function checkQueueDuplicates(recommendationsQueue, entry) {
	if(recommendationsQueue != null && recommendationsQueue.length > 0) {
		for(var i= 0; i < recommendationsQueue.length; ++i) {
			if(unescape(recommendationsQueue[i].toLowerCase()) == unescape(entry.toLowerCase())) {
				return true;
			}
		}
	}
	return false;
}

function rightTrimString(str) {
	if(str != null && str.length > 1 && str.charAt(str.length - 1) == " ") {
		var index = str.length - 1;
		while(str.charAt(index) == " ") {
			--index;
		}

		var newStrArray = null;
		if(index != str.length - 1) {
			newStrArray = str.substring(0, index + 1);
		}
		else {
			newStrArray = str;
		}
		return newStrArray;
	}
	else {
		return str;
	}
}

function generateRecommendations(historyLinks, currentInputStr) {
	// remove trailing spaces to get matches when the user hits a word followed by a space
	currentInputStr = rightTrimString(currentInputStr);

	var recommendationsQueue = new Array();
	if(currentInputStr != null && currentInputStr.length > 0) {
		currentInputStr = currentInputStr.toLowerCase();   // ignore case sensitivity

		for(var i = historyLinks.length - 1; i >= 0; --i) {
			var entryTerms = historyLinks[i].split(ENTRY_DATE_SEP);
			var entryInputStr = unescape(entryTerms[0]);   // the input string stored of cookie is escaped, so chars like ' work in queries
					// hence we have to remember to unescape the cookie descriptuon part.
			if((entryInputStr.toLowerCase().indexOf(currentInputStr) != -1) || (currentInputStr.indexOf(entryInputStr.toLowerCase()) != -1)) {
				if(checkQueueDuplicates(recommendationsQueue, entryTerms[0]) == false) {
					recommendationsQueue.push(escape(entryInputStr));   // before pushing escape it back
				}
			}
			if(recommendationsQueue.length > NUM_SUGGESTIONS_TO_DISPLAY) {
				break;
			}
		}
	}
	else {
		for(var i = historyLinks.length - 1; i >= 0; --i) {
			var entryTerms = historyLinks[i].split(ENTRY_DATE_SEP);
			var entryInputStr = unescape(entryTerms[0]);

			if(checkQueueDuplicates(recommendationsQueue, entryTerms[0]) == false) {
				recommendationsQueue.push(escape(entryInputStr));
				if(recommendationsQueue.length >= NUM_SUGGESTIONS_TO_DISPLAY) {
					break;
				}
			}
		}
	}
	/*
	if(recommendationsQueue.length < historyLinks.length && recommendationsQueue.length < NUM_SUGGESTIONS_TO_DISPLAY) {
		for(var i = historyLinks.length - 1; i >= 0; --i) {
			var entryTerms = historyLinks[i].split(ENTRY_DATE_SEP);

			if(checkQueueDuplicates(recommendationsQueue, entryTerms[0]) == false) {
				recommendationsQueue.push(entryTerms[0]);
				if(recommendationsQueue.length >= NUM_SUGGESTIONS_TO_DISPLAY) {
					break;
				}
			}
		}
	}
	*/

	// if user has no input yet (fresh page, or backspaced input to 0): randomize recommendations for a better quality
	if(currentInputStr == null || currentInputStr.length == 0) {
		recommendationsQueue = randomizeArray(recommendationsQueue)
	}
	return recommendationsQueue;
}

function randomizeArray(anArray) {
	if(anArray.length <= 1) {
		return anArray;
	}
	else {
		var randomizedArray = new Array();
		var usedUpIndexes = new Array();
		var num = -1;
		var flag = false;
		while(anArray.length != randomizedArray.length) {
			do {
				flag = false;
				num = Math.floor(Math.random() * anArray.length);
				// while an unused index is not found, loop
				for(var j = 0; j < usedUpIndexes.length; ++j) {
					if(num == usedUpIndexes[j]) {
						flag = true;
						break;
					}
				}
			} while(flag == true);
			randomizedArray.push(anArray[num]);
			usedUpIndexes.push(num);
		}
		return randomizedArray;
	}
}

function displayRecommendations(historyLinks, currentInputStr) {
	var content = document.getElementById("Recommendations");
	// if no history is recorded
	if(historyLinks == null || historyLinks.length == 0) {
		content.innerHTML = "<div class=\"LightGrayBG\"></div>Once some history is recorded, you will see your personalized recommendations here.<br/></div>";
	}
	else {
		content.innerHTML = "<div class=\"TopRightCorner\" id=\"TopRightCorner\"><a title=\"Recommendations in RSS 2.0 format\" href=\"#\" onclick=\"generateRSS('Recommendations')\">RSS 2.0</a> | <a id=\"ClearAll\" title=\"Edit Recommendations\" href=\"#\" onclick='toggleHistory()'>Edit</a></div>";
		content.innerHTML += "<div class=\"LightGrayBG\"></div>";
		var recommendationsQueue = generateRecommendations(historyLinks, currentInputStr);
		if(recommendationsQueue.length == 0) {
			content.innerHTML = "<div class=\"LightGrayBG\"></div>Recording for future recommendations...";
			return;
		}
		for(var i = 0; i < recommendationsQueue.length; ++i) {
			if(i % 2 == 0) {
				content.innerHTML += "<div class=\"WhiteBG\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + recommendationsQueue[i] + "\', false, false, true)\">" + unescape(recommendationsQueue[i]) + "</a> &laquo;<a class=\"GreenFont\" title=\"Pick this query to edit\" href=\"#\" onclick=\"useThisQuery(\'" + recommendationsQueue[i] + "\', false, false, false)\">e</a>, <a class=\"RedFont\" title=\"Delete ALL occurences of this query\" href=\"#\" onclick=\"removeCookieEntry(\'" + recommendationsQueue[i] + "\', true, false)\">d</a>&raquo;</div>";
			}
			else {
				content.innerHTML += "<div class=\"AlternateColorBG\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + recommendationsQueue[i] + "\', false, false, true)\">" + unescape(recommendationsQueue[i]) + "</a> &laquo;<a class=\"GreenFont\" title=\"Pick this query to edit\" href=\"#\" onclick=\"useThisQuery(\'" + recommendationsQueue[i] + "\', false, false, false)\">e</a>, <a class=\"RedFont\" title=\"Delete ALL occurences of this query\" href=\"#\" onclick=\"removeCookieEntry(\'" + recommendationsQueue[i] + "\', true, false)\">d</a>&raquo;</div>";
			}
		}
		/*
		for(var i = historyLinks.length - 1; count < NUM_SUGGESTIONS_TO_DISPLAY; --i, ++count) {
				var entryTerms = historyLinks[i].split(ENTRY_DATE_SEP);
				if(i % 2 == 0) {
					content.innerHTML += "<div class=\"WhiteBG\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + entryTerms[0] + "\', false, true)\">" + unescape(entryTerms[0]) + "</a></div>";
				}
				else {
					content.innerHTML += "<div class=\"AlternateColorBG\"><a title=\"Follow this query\" href=\"#\" onclick=\"useThisQuery(\'" + entryTerms[0] + "\', false, true)\">" + unescape(entryTerms[0]) + "</a></div>";
				}
				entryTerms = null;   // garbage collected
			}
		}
		*/
	}
	return;
}

/*
function clearCookie(name) {
	var threeDays = 259200000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime() - threeDays);
	document.cookie = name + "=exp; expires=" + expDate.toGMTString();
	window.location.reload();
	return;
}
*/

// Clears all cookies
function clearCookies() {
	if(confirm("Clear entire history (and recommendations)?")) {
		setCookie("", true);   // expire now
		displayRecentMessage("Successfully Cleared History<br/><i><b><a title=\"Reload browser window\" href=\"#\" onclick=\"reloadBrowser()\">Reload</a></b> the browser window to see the changes.</i>");
		// toggleHistory();
		// window.location.reload();
	}
	return;
}

// Cookie Entry Format: [input terms] ENTRY_DATE_SEP TODAYS _DATE
function markCookie(inputStr, sensitive) {
	// escape inputStr so chars like ' work in queries
	var cookieEntry = escape(inputStr) + ENTRY_DATE_SEP + getTodaysDate(true);    // setting shorterFormat to true will return today's date in condensed format
	if(sensitive != null && sensitive == false) {
		setCookie(cookieEntry, false);
	}
	return;
}

function toggleBookmarks() {
	if(! BOOKMARKS_DISPLAYED) {
		displayBookmarks();
		BOOKMARKS_DISPLAYED = true;
	}
	var recommendations = document.getElementById("Recommendations");   // Recommendations section
	var copyright = document.getElementById("Copyright");   // Recommendations section
	var history = document.getElementById("History");   // History section
	var bookmarks = document.getElementById("Bookmarks");   // Bookmarks section
	var hLink = document.getElementById("HistoryLink");   // History/Back Link
	var bLink = document.getElementById("BookmarksLink");   // Bookmarks Link
	var tSpacer = document.getElementById("TopSpacer");   // Top Spacer

	if(bookmarks.style.visibility == "visible") {
		bookmarks.style.visibility = "hidden";
		bookmarks.style.display = "none";
		bLink.style.background = "none";
		bLink.innerHTML = "Bookmarks";
		tSpacer.style.height = "150px";
		history.style.visibility = "hidden";
		history.style.display = "none";
		if(recommendations.style.visibility == "hidden") {
			toggleRecommendations();   // toggling recommendations first is important
		}
		// focusSearchBox();
	}
	else {
		bookmarks.style.visibility = "visible";
		bookmarks.style.display = "block";
		bLink.style.background = "#D8D8D8";
		bLink.innerHTML = "Bookmarks";

		if(history.style.visibility == "visible") {
			toggleHistory();
		}
		if(recommendations.style.visibility == "visible") {
			toggleRecommendations();
		}
		if(copyright.style.visibility == "visible") {
			toggleCopyright();
		}
		tSpacer.style.height = "10px";   // shorten spacer to increase visibility
		// hLink.focus();
	}
	return;
}

function toggleHistory() {
	if(! HISTORY_DISPLAYED) {
		displayHistory(getHistory());
		HISTORY_DISPLAYED = true;
	}
	var bookmarks = document.getElementById("Bookmarks");   // Recommendations section
	var recommendations = document.getElementById("Recommendations");   // Recommendations section
	var copyright = document.getElementById("Copyright");   // Recommendations section
	var history = document.getElementById("History");   // History section
	var hLink = document.getElementById("HistoryLink");   // History/Back Link
	var tSpacer = document.getElementById("TopSpacer");   // Top Spacer

	if(history.style.visibility == "visible") {
		history.style.visibility = "hidden";
		history.style.display = "none";
		hLink.style.background = "none";
		hLink.innerHTML = "History";
		tSpacer.style.height = "150px";
		if(recommendations.style.visibility == "hidden") {
			toggleRecommendations();   // toggling recommendations first is important
		}
		focusSearchBox();
	}
	else {
		history.style.visibility = "visible";
		history.style.display = "block";
		if(recommendations.style.visibility == "visible") {
			toggleRecommendations();
		}
		if(copyright.style.visibility == "visible") {
			toggleCopyright();
		}
		if(bookmarks.style.visibility == "visible") {
			toggleBookmarks();
		}
		hLink.style.background = "#D8D8D8";
		hLink.innerHTML = "History";
		tSpacer.style.height = "10px";
		// hLink.focus();
	}
	return;
}

function toggleRecommendations() {
	if(! RECOMMENDATIONS_DISPLAYED) {
		displayRecommendations(getHistory(), null);
		RECOMMENDATIONS_DISPLAYED = true;
	}
	var bookmarks = document.getElementById("Bookmarks");   // Recommendations section
	var recommendations = document.getElementById("Recommendations");   // Recommendations section
	var copyright = document.getElementById("Copyright");   // Recommendations section
	var history = document.getElementById("History");
	var rLink = document.getElementById("RecommendationsLink");   // Recommendations Link
	var tSpacer = document.getElementById("TopSpacer");   // Top Spacer

	if(recommendations.style.visibility == "visible") {
		recommendations.style.visibility = "hidden";
		recommendations.style.display = "none";
		rLink.style.background = "none";
		// sLink.style.border = "none";
		// sLink.style.borderLeft = "thin solid #A0A0A0";
		rLink.innerHTML = "Recommendations";
		// tSpacer.style.height = "160px";
		// iSpace.style.display = "block";
		// sDesc.style.display = "block";
		// hSection.style.display = "block";
		focusSearchBox();
	}
	else {
		recommendations.style.visibility = "visible";
		recommendations.style.display = "block";
		if(bookmarks.style.visibility == "visible") {
			toggleBookmarks();   // don't show both history and recommendations at the same time
		}
		if(history.style.visibility == "visible") {
			toggleHistory();   // don't show both history and recommendations at the same time
		}
		if(copyright.style.visibility == "visible") {
			toggleCopyright();   // don't show both history and copyright at the same time
		}
		rLink.innerHTML = "Recommendations";
		rLink.style.background = "#D8D8D8";
		// sLink.style.border = "thin solid #A0A0A0";
		// tSpacer.style.height = "10px";
		// iSpace.style.display = "none";
		// sDesc.style.display = "none";
		// hSection.style.display = "none";
		focusSearchBox();
	}
	return;
}

function toggleCopyright() {
	var cLink = document.getElementById("CopyrightLink");
	var bookmarks = document.getElementById("Bookmarks");
	var recommendations = document.getElementById("Recommendations");
	var history = document.getElementById("History");
	var copyright = document.getElementById("Copyright");
	if(copyright.style.visibility == "visible") {
		copyright.style.visibility = "hidden";
		copyright.style.display = "none";
		cLink.innerHTML = "&copy;";
		cLink.style.background = "none";
		cLink.style.textDecoration = "underline";
		if(recommendations.style.visibility == "hidden") {
			toggleRecommendations();
		}
	}
	else {
		copyright.innerHTML = "<div class=\"LightGrayBG\"></div>&copy; 2005-2008 <a title=\"Vishal's Home Page\" href=\"http://vishalshah.org\">Vishal Shah (goldenv)</a>. All rights reserved.<br/>";
		copyright.style.visibility = "visible";
		copyright.style.display = "block";
		cLink.innerHTML = "&copy;";
		cLink.style.background = "#D8D8D8";
		cLink.style.textDecoration = "none";
		if(history.style.visibility == "visible") {
			toggleHistory();
		}
		if(bookmarks.style.visibility == "visible") {
			toggleBookmarks();
		}
		if(recommendations.style.visibility == "visible") {
			toggleRecommendations();
		}
	}
	focusSearchBox();
	return;
}

function getInputStr() {
	var inputStr = document.getElementById("SearchBox").value;
	var i = 0;
	while(inputStr[i++] == ' ')   // strip leading spaces
		;
	i = i - 1;
	inputStr = inputStr.substring(i);
	return inputStr;
}

function displayInfoAlert(info, usage, example, tip, serviceHome) {
	if(serviceHome && serviceHome.length > 0) {
		document.getElementById("ServiceDescription").innerHTML = "<a title=\"Link To Service\" href=\"" + serviceHome + "\">" + info + "</a>";
	}
	else {
		document.getElementById("ServiceDescription").innerHTML = info;
	}
	var hs = document.getElementById("HelpAndTipSection");
	hs.innerHTML = "";
	hs.style.display = "none";
	if(usage && usage.length > 0) {
		hs.style.display = "block";
		hs.innerHTML += "Usage: " + usage + "<br/>";
	}
	if(example && example.length > 0) {
		hs.style.display = "block";
		hs.innerHTML += "Example: " + example + "<br/>";
	}
	if(tip && tip.length > 0) {
		hs.style.display = "block";
		hs.innerHTML += "Tip! " + tip;
	}
	return;
}

function setSearchBoxInput(inputString) {
	var inputBox = document.getElementById("SearchBox");
	inputBox.value = inputString;
	inputBox.select();
	// toggleHistory();   // hide
	// focusSearchBox();
	processInput(false);
	return;
}

function generateUrlAndDescFromInput(inputStr) {
	var urlAndDesc = new Array(2);
	if(inputStr.length != 0) {
		inputStr = inputStr.replace(/\+/g, "%2B");   // First replace any "+" to it's escaped versions. Else queries like "c++" do not work
		inputStr = inputStr.replace(/#/g, "%23");   // First replace any "#" to it's escaped versions. Else queries like "c#" do not work
		var pos = inputStr.lastIndexOf(LUCKY_CODE);

		if((inputStr.length > 2) && (pos == (inputStr.length - LUCKY_CODE.length))) {   // Google's I'm feeling lucky? (Google TM)
			urlAndDesc[0] = "http://www.google.com/search?q=" + inputStr.substring(0, inputStr.length - 2) + "&btnI=" + "I\'m Feeling Lucky";
			urlAndDesc[1] = "Go to Google's First/Top Search Result";
		}
		// Note: inputStr[0] != SWITCH_CODE doesnot seem to work on IE 6 on XP SP2.
		else if(inputStr.charAt(0) != SWITCH_CODE) {   // Plain Web Search
			urlAndDesc[0] = "http://www.google.com/search?q=" + inputStr;
			urlAndDesc[1] = "Google Search";
		}
		else if(inputStr.length > 1 && inputStr.charAt(0) == SWITCH_CODE) {   // Check for a code input
			inputStr = inputStr.substring(1);   // Remove beginning code character
			var loc = getMatch(inputStr, 0);
			urlAndDesc[0] = loc[0];
			urlAndDesc[1] = loc[1];
		}
	}
	return urlAndDesc;
}

function processInput(flag) {
	var inputStr = getInputStr();
	inputStr = inputStr.replace(/\+/g, "%2B");   // First replace any "+" to it's escaped versions. Else queries like "c++" do not work
	inputStr = inputStr.replace(/#/g, "%23");   // First replace any "#" to it's escaped versions. Else queries like "c#" do not work
	displayRecommendations(getHistory(), inputStr);
	var pos = inputStr.lastIndexOf(LUCKY_CODE);
	document.getElementById("SearchBox").style.color = "#303030";

	/*
	if(inputStr.length == 4) {
		var history = getHistory();
		for(var i = 0; i < history.length; ++i) {
			var historyTextInput = (history[i].split(ENTRY_DATE_SEP))[0];
			// get the first 4 characters out to compare
			var first4Chars = historyTextInput.substring(0, 4);
			// alert("inputStr.toLowerCase() " + inputStr.toLowerCase() + ", historyTextInput " + historyTextInput.toLowerCase());
			if(inputStr.toLowerCase() == first4Chars) {
				setSearchBoxInput(historyTextInput);
				return;
			}
		}
	}
	*/
	if(inputStr.length == 0) {   // Display welcome information
		displayInfoAlert(getWelcomeString(), "", "", "", "");
	}
	else if((inputStr.indexOf("http://") == 0) || (inputStr.indexOf("https://") == 0)|| (inputStr.indexOf("ftp://") == 0) || (inputStr.indexOf("www.") == 0)) {
		if(inputStr.indexOf("www.") == 0) {   // prepend http://, else redirection will not work since this a local file
			var tempStr = "http://" + inputStr;
			inputStr = tempStr;
		}
		document.getElementById("SearchBox").style.color = "#0000FF";
		var desc = "Follow the URL... <br/><i>(Prepend " + SWITCH_CODE + "g to search for the URL using Google. Use can also use MSN, Yahoo... searches similarly</i>" ;
		displayInfoAlert(desc, "", "", "", "");
		if(flag) {   // Only redirect when user hits enter
			url = inputStr;
			var sensitive = false;
			goRedirect(inputStr, url, desc, sensitive);
		}
	}
	else if((inputStr.length > 2) && (pos == (inputStr.length - LUCKY_CODE.length))) {   // Google's I'm feeling lucky? (Google TM)
		document.getElementById("SearchBox").style.color = "#0000FF";
		var desc = "Go to Google's First/Top Search Result";
		displayInfoAlert(desc, "", "", "", "");
		var url = "";
		if(flag) {   // Only redirect when user hits enter
			url = "http://www.google.com/search?q=" + inputStr.substring(0, inputStr.length - 2) + "&btnI=" + "I\'m Feeling Lucky";
			var sensitive = false;
			goRedirect(inputStr, url, desc, sensitive);
		}
	}
	// Note: inputStr[0] != SWITCH_CODE doesnot seem to work on IE 6 on XP SP2.
	else if(inputStr.charAt(0) != SWITCH_CODE) {   // Plain Web Search
		var desc = "Google Search";
		var serviceHome = "http://www.google.com";
		var tip = "Use " + SWITCH_CODE + "gg, " + SWITCH_CODE + "gn or " + SWITCH_CODE +  "gi to search Google Groups, News or Image Search"
		displayInfoAlert(desc, "", "", tip, serviceHome);
		var url = "";
		if(flag) {   // Only redirect when user hits enter
			url = "http://www.google.com/search?q=" + inputStr;
			var sensitive = false;
			goRedirect(inputStr, url, desc, sensitive);
		}
	}
	else if(inputStr.length > 1 && inputStr.charAt(0) == SWITCH_CODE) {   // Check for a code input
		inputStr = inputStr.substring(1);   // Remove beginning code character
		if(flag) {   // Do the actual search by redirecting
			var loc = getMatch(inputStr, 1);
			var url = loc[0];
			var desc = loc[1];   // currently not used in goRedirect() or markCookie().
			var direction = loc[2];
			var sensitive = loc[7];
			if(direction == "go") {
				// redirect
				goRedirect(SWITCH_CODE + inputStr, url, desc, sensitive);
			}
		}
		else {   // Just display relevant information alert
			var loc = getMatch(inputStr, 0);   // 0 is a flag to notify onkeydown event
			var url = loc[0];
			var desc = loc[1];
			var tip = loc[3];
			var usage = loc[4];
			var example = loc[5];
			var serviceHome = loc[6];
			displayInfoAlert(desc, usage, example, tip, serviceHome);
		}
	}
	return false;
}

function goRedirect(inputStr, url, desc, sensitive) {
	markCookie(inputStr, sensitive);   // add Cookie Details
	window.location.href = url;
	return;
}

function getMatch(inputStr, isKeyDown) {
	// TODO: Add arguments to codes
	// Remove duplicate case 's by adding 2 or more case statements for aliases
	// Add multiple engine support using y,g,m query - comma separated
	// ADD USAGE AND EXAMPLE
	// First case is major name and rest cases for quer are called aliases
	// Split this function into 2 - one for if part and other for else.

	// ADD LINKs along with usage, tip...

	document.getElementById("SearchBox").style.color = "#0000FF";
	var terms = inputStr.split(" ");
	var query = inputStr.substring(terms[0].length + 1);

	// Check for multiple codes
	var codes = terms[0].split(",");
	var multipleCodes = "false";
	if(codes.length > 1) {
		multipleCodes = "true";
	}
	else {
		codes = new Array(1);
		codes[0] = terms[0];
	}
	var matchDetails = null;
	if(terms.length > 1) {
		matchDetails = getSearchQueryDetails(inputStr, codes, query, multipleCodes, isKeyDown);
	}
	else {
		matchDetails = getBookmarkDetails(inputStr, codes, query, multipleCodes, isKeyDown);
	}
	// extract match details
	var url = matchDetails[0];
	var desc = matchDetails[1];
	var usage = matchDetails[2];
	var example = matchDetails[3];
	var tip = matchDetails[4];
	var serviceHome = matchDetails[5];
	var sensitive = matchDetails[6];

	// return all details in a locAndDesc object
	var locAndDesc = new Array(8);
	locAndDesc[0] = url;
	if(multipleCodes == "true") {
		serviceHome = "";   // no particular service site should be linked
		locAndDesc[1] = "Multi-Site Query";
		usage = SWITCH_CODE + "[code1],[code2],... [Search Text]";
		var queryStr = SWITCH_CODE + "g,y,m,wp Pablo Picasso";
		example = "<a title='Use this query' href='#' onclick=\"useThisQuery(\'" + queryStr + "\', false, false, false)\">" + queryStr + "</a>";
		locAndDesc[2] = "stay";
	}
	else {
		locAndDesc[1] = desc;
		locAndDesc[2] = "go";
	}
	locAndDesc[3] = tip;
	locAndDesc[4] = usage;
	locAndDesc[5] = example;
	locAndDesc[6] = serviceHome;
	locAndDesc[7] = sensitive;

	return locAndDesc;
}

// ======================================================================
// Use codes to get bookmark details
// SET YOUR OWN BOOKMARKS HERE
// ======================================================================
function getBookmarkDetails(inputStr, codes, query, multipleCodes, isKeyDown) {
	var url = "", desc = "", usage = "", example = "", tip = "", serviceHome = "", sensitive = false;
	document.getElementById("SearchBox").style.color = "#0000FF";
	switch(inputStr) {   // bookmarks
		case "awad":
			desc = "A.Word.A.Day";
			url = "http://www.wordsmith.org/words/today.html";
			break;
		case "astro":
		case "astrology":
			desc = "Yahoo! Astrology";
			url = "http://astrology.yahoo.com/astrology/";
			break;
		case "castro":
		case "castrology":
			desc = "Yahoo! Chinese Astrology";
			url = "http://astrology.yahoo.com/chinese/general/dailyoverview";
			break;
		case "discovery":
			desc = "The Discovery Channel";
			url = "http://www.discovery.com/";
			break;
		case "topmovies":
			desc = "Top Movies at RottenTomatoes.com";
			url = "http://www.rottentomatoes.com/top/";
			break;
		case "boxoffice":
			desc = "U.S. Box Office - Yahoo! Movies";
			url = "http://movies.yahoo.com/boxoffice/latest/rank.html";
			break;
		case "nyt":
			desc = "The New York Times";
			url = "http://www.nytimes.com/";
			break;
		case "ebay":
			desc = "eBay.com";
			url = "http://www.ebay.com/";
			break;
		case "/.":
			desc = "Slashdot.org";
			url = "http://slashdot.org";
			break;
		case "rt":
			desc = "RottenTomatoes.com";
			url = "http://www.rottentomatoes.com";
			break;
		case "news":
			desc = "BBC News";
			url = "http://news.bbc.co.uk/";
			break;
		case "onthisday":
		case "thisday":
			desc = "On This Day in History";
			url = "http://news.bbc.co.uk/onthisday/";
			break;
		case "msnbc":
			desc = "MSNBC News Service";
			url = "http://www.msnbc.msn.com/";
			break;
		case "newsbot":
			desc = "MSN Newsbot";
			url = "http://newsbot.msnbc.msn.com/";
			break;
		case "newgames":
			desc = "List All New Games Released This Week";
			url = "http://www.gamespot.com/newthisweek/platform/";
			tip = "Use " + SWITCH_CODE + "games To Search For Games By Title";
			break;
		case "sourceforge":
			desc = "SourceForge.net";
			url = "http://sourceforge.net";
			break;
		case "traceroute":
			desc = "Trace the route!";
			url = "http://www.traceroute.org/";
			break;
		case "ipaddress":
			desc = "Find your IP Address";
			url = "http://www.whatismyip.com/";
			break;
		case "w3":
			desc = "World Wide Web Consortium";
			url = "http://www.w3.org";
			break;
		case "amazon":
			desc = "Amazon.com";
			url = "http://www.amazon.com/";
			break;
		case "amazonbooks":
			desc = "Amazon.com Books";
			url = "http://www.amazon.com/exec/obidos/tg/browse/-/283155/104-6352461-4005537";
			break;
		case "a9":
			desc = "Amazon's A9 Search Service";
			url = "http://a9.com/";
			break;
		case "recipes":
			desc = "Get Recipes";
			url = "http://www.recipesource.com/";
			break;
		case "bank":
			desc = "Bank of America";
			url = "http://www.bankofamerica.com";
			// sensitive = true;   // sensitive information. Do not record in history
			break;
		case "cnn":
			desc = "CNN";
			url = "http://www.cnn.com";
			break;
		case "sell":
			desc = "Amazon.com Marketplace Open Listings";
			url = "http://www.amazon.com/gp/seller-account/inventory/list-inventory.html/104-0894562-0745506";
			break;
		case "ifm":
			desc = "IndiaFM.com";
			url = "http://www.indiafm.com";
			break;
		case "md":
			desc = "Mid-Day.com";
			url = "http://www.mid-day.com";
			break;
		case "target":
			desc = "Target.com";
			url = "http://www.target.com";
			serviceHome = "http://www.target.com";
			break;
		default:
			document.getElementById("SearchBox").style.color = "#303030";
			// **HERE THERE WILL BE USER DEFINED QUERIES/BOOKMARKS**

			desc = "Google Search";
			// Note: It is important to add the Code, which we previously stripped!
			url = "http://www.google.com/search?q=" + SWITCH_CODE + inputStr;
			break;
	}
	var matchDetails = new Array(6);
	matchDetails[0] = url;
	matchDetails[1] = desc;
	matchDetails[2] = usage;
	matchDetails[3] = example;
	matchDetails[4] = tip;
	matchDetails[5] = serviceHome;
	matchDetails[6] = sensitive;

	return matchDetails;
}

// ======================================================================
// Use codes to get appropriate site details
// SET YOUR OWN CODES HERE
// ======================================================================
function getSearchQueryDetails(inputStr, codes, query, multipleCodes, isKeyDown) {
	var url = "", desc = "", usage = "", example = "", tip = "", serviceHome = "", sensitive = false;

	// Loop for every code
	for(var j = 0; j < codes.length; ++j) {
		switch(codes[j].toLowerCase()) {   // codelets
			// TODO: Categorize Codes and
			// If the query length is 0 - redirect to the site's home page
			case "addall":
				desc = "AddALL.com Book Comparison Search";
				usage = SWITCH_CODE + "addall [ISBN]";
				example = SWITCH_CODE + "addall 0744002907";
				url = "http://www3.addall.com/New/submitNew.cgi?query=" + query + "&type=ISBN&location=&state=&dispCurr=USD";
				serviceHome = "http://www.addall.com";
				break;

			case "pricegrabber":
				desc = "PriceGrabber.com Product Comparison Search";
				usage = SWITCH_CODE + "pricegrabber [Product Keywords, ISBN, ...]";
				example = SWITCH_CODE + "pricegrabber Prince of Persia Xbox";
				url = "http://www.pricegrabber.com/search.php?topcat_search=1&form_keyword=" + query + "&topcat_id=&Search=Search";
				serviceHome = "http://www.pricegrabber.com";
				break;

			case "g":
			case "google":
				desc = "Google Search";
				url = "http://www.google.com/search?q=" + query;
				serviceHome = "http://www.google.com";
				break;
			case "gi":
			case "image":
			case "images":
				desc = "Google Image Search";
				url = "http://images.google.com/images?q=" + query;
				serviceHome = "http://images.google.com";
				break;
			case "gn":
			case "news":
				desc = "Google News Search";
				url = "http://news.google.com/news?q=" + query;
				serviceHome = "http://news.google.com";
				break;
			case "gg":
			case "groups":
			case "usenet":
				desc = "Google Groups Search";
				url = "http://groups.google.com/groups?q=" + query;
				serviceHome = "http://groups.google.com";
				break;
			case "gs":				
			case "scholar":
				desc = "Google Scholar Search";
				url = "http://scholar.google.com/scholar?q=" + query;
				serviceHome = "http://scholar.google.com";
				break;
			case "ga":
				desc = "Search Google Answers";
				url = "http://answers.google.com/answers/search?q=" + query;
				serviceHome = "http://answers.google.com";
				break;
			case "gl":
			case "glocal":
			case "local":   // DEFAULT FOR TERM/QUERY
				desc = "Google Local Search";
				var fields = query.split("/");
				url = "http://local.google.com/local?q=" + fields[0] + "&near=" + fields[1] + "&sl=1";
				usage = SWITCH_CODE + "glocal [place of interest] / [City], [State]";
				example = SWITCH_CODE + "glocal coffee shops / Minneapolis, MN";
				tip = "State is optional";
				serviceHome = "http://local.google.com";
				break;
			case "gp":
			case "froogle":
				desc = "Google Shopping/Products Search";
				url = "http://google.com/products?q=" + query;
				serviceHome = "http://google.com/products";
				break;
			case "gc":
			case "catalog":
			case "catalogs":
				desc = "Google Catalog Search";
				url = "http://catalogs.google.com/catalogs?q=" + query;
				serviceHome = "http://catalogs.google.com";
				break;
			case "site":
				desc = "Search A Specific Web Site";
				var space = query.indexOf(' ');
				url = "http://www.google.com/search?q=site:" + query.substring(0, space) + "%20" + query.substring(space + 1);
				usage = SWITCH_CODE + "site [site address] [query]";
				example = SWITCH_CODE + "site vishalshah.org minnesota";
				serviceHome = "http://www.google.com";
				break;
			// Domain Related
			case "edu":
				desc = "Search Only *.edu Domains";
				url = "http://www.google.com/search?q=site%3Aedu+" + query;
				serviceHome = "http://www.google.com/search?q=site%3Aedu";
				break;
			case "org":
				desc = "Search Only *.org Domains";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Aorg+" + query;
				serviceHome = "http://www.google.com/search?q=site%3Aorg";
				break;
			case "com":
				desc = "Search Only *.com Domains";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Acom+" + query;
				serviceHome = "http://www.google.com/search?q=site%3Acom";
				break;
			case "net":
				desc = "Search Only *.net Domains";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Anet+" + query;
				serviceHome = "http://www.google.com/search?q=site%3Anet";
				break;
			case "us":
				desc = "Search Only *.us Domains";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Aus+" + query;
				tip = "Use " + SWITCH_CODE + "gov to search U.S. Government Web Sites";
				serviceHome = "http://www.google.com/search?q=site%3Aus";
				break;
			// U.S. Government related
			case "gov":
				desc = "Search U.S. Government Web Sites (Only *.gov Domains)";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Agov+" + query;
				serviceHome = "http://www.google.com/search?q=site%3Agov";
				break;
			case "irs":
				desc = "Search IRS Web Site";
				url = "http://www.google.com/search?q=site:irs.gov+" + query;
				tip = "Use " + SWITCH_CODE + "irsf for searching IRS Forms and Publications"
				serviceHome = "http://search.irs.gov";
				break;
			case "uscis":
			case "ins":
				desc = "Search USCIS (U.S. Citizenship and Immigration Services)";
				url = "http://www.google.com/search?q=site:uscis.gov+" + query;
				serviceHome = "http://www.google.com/search?q=site:uscis.gov";
				break;
			case "fda":
				desc = "Search FDA (U.S. Food and Drug Administration)";
				url = "http://google.fda.gov/search?q=" + query;
				serviceHome = "http://google.fda.gov";
				break;
			case "sec":
				desc = "Search SEC (U.S. Securities and Exchange Commission)";
				url = "http://www.sec.gov/cgi-bin/txt-srch-sec?text=" + query;
				serviceHome = "http://www.sec.gov";
				break;
			case "ftc":
				desc = "Search FTC (Federal Trade Commission)";
				url = "http://search.ftc.gov/query.html?qt=" + query;
				serviceHome = "http://search.ftc.gov/";
				break;
			case "census":
				desc = "Search The U.S. Census Bureau";
				url = "http://www.googlesyndicatedsearch.com/u/census?q=" + query;
				serviceHome = "http://www.googlesyndicatedsearch.com/u/census";
				break;
			case "nasa":
				desc = "Search NASA (National Aeronautics and Space Administration)";
				url = "http://search.nasa.gov/nasasearch/search/search.jsp?nasaInclude=" + query;
				serviceHome = "http://search.nasa.gov";
				break;
			// Filetype related
			case "txt":
				desc = "Search Only Text Files";
				url = "http://www.google.com/search?q=filetype%3Atxt+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Atxt";
				break;
			case "pdf":
				desc = "Search Only PDF (Portable Document Format) Documents";
				url = "http://www.google.com/search?q=filetype%3Apdf+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Apdf";
				break;
			case "ps":
				desc = "Search Only PS (Postscript Format) Documents";
				url = "http://www.google.com/search?q=filetype%3Aps+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Aps";
				break;
			case "doc":
				desc = "Search Only Word (Microsoft&reg; Word) Documents";
				url = "http://www.google.com/search?q=filetype%3Adoc+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Adoc";
				break;
			case "mw":
				desc = "Search Only MacWrite Documents";
				url = "http://www.google.com/search?q=filetype%3Amw+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Amw";
				break;
			case "lwp":
				desc = "Search Only Lotus WordPro Documents";
				url = "http://www.google.com/search?q=filetype%3Alwp+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Alwp";
				break;
			case "ppt":
				desc = "Search Only PPT (PowerPoint Presentations) Documents";
				url = "http://www.google.com/search?q=filetype%3Appt+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Appt";
				break;
			case "xls":
				desc = "Search Only Excel (Microsoft&reg; Excel) Worksheets";
				url = "http://www.google.com/search?q=filetype%3Axls+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Axls";
				break;
			case "swf":
				desc = "Search Only Macromedia Shockwave Flash Files";
				url = "http://www.google.com/search?q=filetype%3Aswf+" + query;
				serviceHome = "http://www.google.com/search?q=filetype%3Aswf";
				break;
			// Yahoo! related
			case "y":
			case "yahoo":
			desc = "Yahoo! Search";
				url = "http://search.yahoo.com/search?p=" + query;
				serviceHome = "http://search.yahoo.com";
				tip = "Use " + SWITCH_CODE + "yq for Y!Q Search";
				break;
			case "yq":
				desc = "Y!Q Search";
				var items = query.split("//");
				if(items[1] != null && items[1].length > 0) {
					url = "http://yq.search.yahoo.com/search?p=" + items[0] + "&context=" + items[1];
				}
				else {
					url = "http://yq.search.yahoo.com/search?p=" + query;
				}
				usage = SWITCH_CODE + "yq [search terms] // [context terms]";
				example = SWITCH_CODE + "yq great white // national geographic";
				serviceHome = "http://yq.search.yahoo.com/splash/start.html";
				break;
			case "yi":
			case "yimage":
				desc = "Yahoo! Image Search";
				url = "http://images.search.yahoo.com/search/images?p=" + query;
				serviceHome = "http://images.search.yahoo.com";
				break;
			case "yv":
			case "yvideo":
			case "video":
			case "videos":
				desc = "Yahoo! Video Search";
				url = "http://video.search.yahoo.com/search/video?p=" + query;
				serviceHome = "http://video.search.yahoo.com";
				break;
			case "yn":
			case "ynews":
			case "yahoonews":
				desc = "Yahoo! News Search";
				url = "http://news.search.yahoo.com/search/news/?p=" + query;
				serviceHome = "http://news.search.yahoo.com";
				break;
			case "yd":
			case "ydir":
				desc = "Search Yahoo! Directory";
				url = "http://search.yahoo.com/search/dir?p=" + query;
				serviceHome = "http://search.yahoo.com/dir";
				break;
			case "ys":
			case "yshop":
			case "yshopping":
				desc = "Yahoo! Shopping Search";
				url = "http://shopping.yahoo.com/search?p=" + query;
				serviceHome = "http://shopping.yahoo.com/search";
				break;
			case "w":
			case "weather":
			case "forecast":
				desc = "Weather Forecast";
				url = "http://search.weather.yahoo.com/weather/query.cgi?q=" + query;
				serviceHome = "http://search.weather.yahoo.com";
				break;
			case "sports":
			case "yahoosports":
				desc = "Search Sports News - Yahoo! Sports";
				url = "http://sports.yahoo.com/search?type=sports&p=" + query;
				serviceHome = "http://sports.yahoo.com";
				break;
			case "currency":
			case "currencyconvert":
			case "cc":
				desc = "Convert Currency";
				usage = "[Amt.] [From Currency] [To Currency]";
				example = "1 USD JPY";
				var currencies = query.split(" ");
				if(currencies.length > 2) {
					url = "http://finance.yahoo.com/currency/convert?amt=" + currencies[0] + "&from=" + currencies[1] + "&to=" + currencies[2] + "&submit=Convert";
				}
				else {
					url = "http://finance.yahoo.com/currency";
				}
				serviceHome = "http://finance.yahoo.com/currency";
				break;
			case "showtimes":
				desc = "Get Movie Showtimes - Yahoo! Movies";
				url = "http://movies.yahoo.com/showtimes/showtimes.html?z=" + query;
				serviceHome = "http://movies.yahoo.com/showtimes";
				break;
			case "movies":
			case "trailers":
				desc = "Search For Movies, Trailers, Reviews, DVD Info, Photos, Trailers & Clips - Yahoo! Movies";
				url = "http://movies.yahoo.com/mv/search?p=" + query;
				serviceHome = "http://movies.yahoo.com/mv";
				break;
			case "music":
			case "launch":
				desc = "Yahoo! LAUNCH Music Search";
				url = "http://search.launch.yahoo.com/search/lsearch/all?p=" + query;
				serviceHome = "http://search.launch.yahoo.com";
				break;

			case "sourceforge":
				desc = "Search SourceForge.net";
				url = "http://sourceforge.net/search/?type_of_search=soft&exact=1&forum_id=0&group_id=0&atid=0&words=" + query;
				break;
			// MSN related
			case "m":
			case "msn":
				desc = "MSN Search";
				url = "http://search.msn.com/results.aspx?q=" + query;
				serviceHome = "http://search.msn.com";
				break;
			case "mnews":
			case "msnnews":
				desc = "MSN News Search";
				url = "http://search.msn.com/news/results.aspx?q=" + query;
				serviceHome = "http://search.msn.com";
				break;
			case "encarta":
				desc = "MSN Encarta Search";
				url = "http://search.msn.com/encarta/results.aspx?q=" + query;
				serviceHome = "http://encarta.msn.com";
			case "msnbc":
				desc = "MSNBC Search";
				url = "http://www.msnbc.msn.com/?querytext=" + query + "&id=3053419&action=fulltext";
				serviceHome = "http://www.msnbc.msn.com";
				break;
			case "newsbot":
				desc = "MSN Newsbot Search";
				url = "http://newsbot.msnbc.msn.com/search/?nq=" + query;
				serviceHome = "http://newsbot.msnbc.msn.com";
				break;
			// Sports And Games
			case "game":
			case "games":
				desc = "GameSpot.com - Search For Games By Title";
            url = "http://www.gamespot.com/search.html?sub=g&stype=11&type=11&qs=" + query;
				example = SWITCH_CODE + "games serious sam";
				tip = "Use " + SWITCH_CODE + "newgames to find all games just released this week!";
				serviceHome = "http://www.gamespot.com";
				break;
         case "ign":
            desc = "IGN.com - Search For Games By Title";
            url = "http://my.ign.com/my/sb?pageID=2003&nuaction=gameSearch&gameTitleSearch=" + query;
            example = SWITCH_CODE + "ign rainbow six";
            tip = "Use " + SWITCH_CODE + "newgames to find all games just released this week!";
            serviceHome = "http://www.ign.com";
            break;
         case "ebgames":
            desc = "EBGames.com - Search For Games By Title";
            url = "http://www.ebgames.com/ebx/categories/products/deptpage.asp?wherefrom=search&searchword=" + query;
            example = SWITCH_CODE + "ebgames megaman";
            tip = "Use " + SWITCH_CODE + "newgames to find all games just released this week!";
            serviceHome = "http://www.ebgames.com";
            break;
         case "gamestop":
            desc = "GameStop.com - Search For Games By Title";
            url = "http://www.gamestop.com/search.asp?sortby=default&searchtype=quicksearch&searchcount=12&platform=0&find.x=11&find.y=10&find=Search&keyword=" + query;
            example = SWITCH_CODE + "gamestop megaman";
            tip = "Use " + SWITCH_CODE + "newgames to find all games just released this week!";
            serviceHome = "http://www.gamestop.com";
            break;
			case "gamespy":
				desc = "Search GameSpy.com";
				url = "http://search.gamespy.com/my/sb?pageID=2003&nuaction=gameSearch&platformSearch=-1&esrb=&scoreRangeSearch=&x=0&y=0&gameTitleSearch=" + query;
				serviceHome = "http://www.gamespy.com";
				break;
			case "f1":
			case "formula1":
				desc = "Search F1 - Formula1.com";
				url = "http://www.google.com/search?q=site%3Aformula1.com+" + query;
				serviceHome = "http://www.formula1.com";
				break;
			case "nascar":
				desc = "Search NASCAR (National Association For Stock Car Auto Racing) - NASCAR.com";
				url = "http://www.google.com/search?q=site%3Anascar.com+" + query;
				serviceHome = "http://www.nascar.com";
				break;
			case "si":
				desc = "Search Sports Illustarted - SI.com";
				url = "http://search.sportsillustrated.cnn.com/pages/search/advanced.jsp?Coll=si_xml&QuerySubmit=true&Page=1&QueryText=" + query + "&sites=si&query=" + query;
				serviceHome = "http://www.sportsillustrated.com";
				break;
			case "espn":
				desc = "Search ESPN Sports - ESPN.com";
				url = "http://proxy.espn.go.com/keyword/searchResults?search=" + query + "&searchType=0&site=espn";
				serviceHome = "http://www.espn.com";
				break;
			case "nfl":
				desc = "Search The NFL (National Football League)";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Anfl.com+" + query;
				serviceHome = "http://www.nfl.com";
				break;
			case "nhl":
				desc = "Search The NHL (National Hockey League)";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Anhl.com+" + query;
				serviceHome = "http://www.nhl.com";
				break;
			case "nba":
				desc = "Search The NBA (National Basketball Association)";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Anba.com+" + query;
				serviceHome = "http://www.nba.com";
				break;
			case "mlb":
				desc = "Search MLB (Major League Baseball)";
				url = "http://www.google.com/search?hl=en&lr=&q=site%3Amlb.com+" + query;
				serviceHome = "http://www.mlb.com";
				break;
				// c|net
			case "cnet":
				desc = "Search c|net";
				url = "http://cnet.search.com/search?curl=1,0,0-0-0&timeout=3&tag=srch&qt=" + query;
				serviceHome = "http://www.cnet.com";
				break;
			case "cnetnews":
			case "cnews":
				desc = "Search c|net News";
				url = "http://news.search.com/search?q=" + query;
				serviceHome = "http://www.news.com";
				break;
			case "download":
				desc = "c|net - Download.com";
				url = "http://www.download.com/3120-20_4-0.html?qt=" + query;
				serviceHome = "http://www.download.com";
				break;
			// Microsoft Corporation
			case "microsoft":
			case "ms":
				desc = "Search Microsoft Corp.";
				url = "http://search.microsoft.com/search/results.aspx?st=b&na=88&View=en-us&qu=" + query;
				serviceHome = "http://www.microsoft.com";
				break;
			// Apple Computer, Inc.
			case "apple":
				desc = "Search Apple Computer, Inc.";
				url = "http://searchcgi.apple.com/cgi-bin/sp/nph-searchpre1.pl?client=www_collection&access=p&lr=lang_en&subcol=us_only&q=" + query;
				serviceHome = "http://www.apple.com";
				break;
			// Linux - Currently searches Google's index of Linux.org
			case "linux":
			case "penguin":
				desc = "Search Linux.org";
				url = "http://www.google.com/search?q=site:linux.org+" + query;
				serviceHome = "http://www.linux.org";
				break;
			case "tldp":
				desc = "Search The Linux Documentation Project";
				url = "http://www.google.com/search?q=site:tldp.org+" + query;
				serviceHome = "http://www.tldp.org";
				break;
			case "unix":
				desc = "Search Unix Guru Universe - Ugu.com";
				url = "http://www.google.com/search?q=site:ugu.com+" + query;
				serviceHome = "http://www.ugu.com";
				break;
			// Astrology
			case "astro":
			case "astrology":
				desc = "Yahoo! Astrology";
				url = "http://astrology.yahoo.com/astrology/general/dailyoverview/" + query.toLowerCase();
				usage = SWITCH_CODE + "astro [sign]";
				example = SWITCH_CODE + "astro capricorn";
				serviceHome = "http://astrology.yahoo.com";
				break;
			case "castro":
			case "castrology":
			case "chineseastro":
				desc = "Yahoo! Chinese Astrology";
				url = "http://astrology.yahoo.com/chinese/general/dailyoverview/"; + query.toLowerCase();
				usage = SWITCH_CODE + "castro [sign]";
				example = SWITCH_CODE + "castro horse";
				serviceHome = "http://astrology.yahoo.com/chinese";
				break;
			// Amazon - Uses Google Site Search
			case "amazon":
			case "az":
				desc = "Amazon.com Complete Search";
				url = "http://www.amazon.com/s/ref=nb_ss_gw/103-2088649-2216649?url=search-alias%3Daps&field-keywords=" + query;
				usage = SWITCH_CODE + "castro [sign]";
				serviceHome = "http://www.amazon.com";
				break;
			case "amazonbooks":
			case "book":
			case "books":
				desc = "Amazon.com Book Search";
				url = "http://www.amazon.com/exec/obidos/search-handle-url/ref=dp_searchBox_1/103-3406329-1328622?url=index%3Dbooks%26dispatch%3Dsearch%26results-process%3Dbin&field-keywords=" + query + "&x=0&y=0";
				serviceHome = "http://www.amazon.com/exec/obidos/tg/browse/-/283155";
				break;
			case "dvd":
				desc = "Amazon.com DVD Search";
				url = "http://www.google.com/search?q=site%3Aamazon.com%20dvd+" + query;
				serviceHome = "http://www.amazon.com/exec/obidos/tg/browse/-/130";
				break;
			case "vhs":
				desc = "Amazon.com VHS Search";
				url = "http://www.google.com/search?q=site%3Aamazon.com%20video+" + query;
				serviceHome = "http://www.amazon.com/exec/obidos/tg/browse/-/404272";
				break;
			case "electronics":
				desc = "Amazon.com Electronics Search";
				url = "http://www.google.com/search?q=site%3Aamazon.com%20amazon electronics+" + query;
				serviceHome = "http://www.amazon.com/exec/obidos/tg/browse/-/172282";
				break;

			case "target":
				desc = "Search Target.com";
				url = "http://www.target.com/gp/search.html/ref=sr_bx_1/602-2125120-9457445?field-keywords=" + query + "&url=index%3Dtarget&x=0&y=0";
				serviceHome = "http://www.target.com";
				break;
			// A9.com - To get Amazon Book Results
			case "a9":
				desc = "A9 Search";
				url = "http://a9.com/" + query;
				serviceHome = "http://www.a9.com";
				break;
			// Altavista related
			case "av":
			case "altavista":
				desc = "AltaVista Search";
				url = "http://www.altavista.com/web/results?itag=wrx&q=" + query;
				serviceHome = "http://www.altavista.com";
				break;
			case "avi":
				desc = "AltaVista Image Search";
				url = "http://www.altavista.com/image/results?itag=wrx&q=" + query;
				serviceHome = "http://www.altavista.com/image";
				break;
			case "avn":
				desc = "AltaVista News Search";
				url = "http://www.altavista.com/news/results?q=" + query;
				serviceHome = "http://www.altavista.com/news";
				break;
			case "avd":
				desc = "AltaVista Directory Search";
				url = "http://www.overture.com/d/search/p/altavista/odp/index.jhtml?mkt=us&q=" + query;
				serviceHome = "http://www.altavista.com/dir/";
				break;
			// DMOZ
			case "dmoz":
				desc = "Search DMOZ.org";
				url = "http://search.dmoz.org/cgi-bin/search?search=" + query;
				serviceHome = "http://www.dmoz.org";
				break;
			// Unix
			case "man":
				desc = "Search Unix/Linux Manual Pages - Rt.com";
				url = "http://www.google.com/custom?domains=rt.com&sa=Search&sitesearch=rt.com&q=" + query;
				usage = SWITCH_CODE + "man [name]";
				serviceHome = "http://www.rt.com";
				break;
			case "rpm":
			case "rpms":
				desc = "Find RPM's for Linux Distributions - FreshRPMs.net";
				//url = "http://rpmfind.net/linux/rpm2html/search.php?query=" + query;
				url = "http://www.google.com/search?q=site:freshrpms.net+" + query;
				usage = SWITCH_CODE + "rpm [query]";
				example = SWITCH_CODE + "rpm twisted python";
				serviceHome = "http://www.freshrpms.net";
				break;
			// Netcraft
			case "netcraft":
				desc = "What's That Site Running? - Netcraft.com";
				url = "http://uptime.netcraft.com/up/graph?site=" + query;
				serviceHome = "http://www.netcraft.com";
				break;
			case "reverseip":
				desc = "Reverse IP Lookup";
				url = "http://www.zoneedit.com/lookup.html?reverse=Look+it+up&ipaddress=" + query;
				usage = SWITCH_CODE + "reverseip [ipaddress]";
				example = SWITCH_CODE + "reverseip 66.218.71.63";
				serviceHome = "http://www.zoneedit.com/lookup.html";
				break;
			// BBC Related
			case "bbc":
			case "bbcnews":
				desc = "Search BBC News";
				url = "http://newssearch.bbc.co.uk/cgi-bin/search/results.pl?scope=newsifs&tab=news&q=" + query;
				serviceHome = "http://newssearch.bbc.co.uk";
				break;
			case "bbcsports":
				desc = "Search BBC Sports";
				url = "http://newssearch.bbc.co.uk/cgi-bin/search/results.pl?scope=newsifs&tab=sport&q=" + query;
				serviceHome = "http://newssearch.bbc.co.uk";
				break;
			// CNN
			case "cnn":
				desc = "Search CNN";
				url = "http://search.cnn.com/pages/search/advanced.jsp?Coll=cnn_xml&QuerySubmit=true&Page=1&QueryText=" + query+ "&query=" + query;
				serviceHome = "http://search.cnn.com";
				break;
			// Dictionary, Thesaurus
			case "d":
			case "dict":
			case "dictionary":
				desc = "Search Dictionary";
				url = "http://www.answers.com/" + query;
				usage = SWITCH_CODE + "dict cosmos";
				serviceHome = "http://www.answers.com/";
				break;
			case "th":
			case "thesaurus":
				desc = "Search Thesaurus";
				url = "http://thesaurus.reference.com/search?q=" + query;
				serviceHome = "http://thesaurus.reference.com";
				break;
			// New York Times
			case "nyt":
			case "newyorktimes":
				desc = "Search The New York Times (NYT)";
				url = "http://query.nytimes.com/search/query?query=" +  query + "&date_select=full&srchst=nyt";
				serviceHome = "http://www.nytimes.com";
				break;
			case "mysimon":
			case "shop":   // _KEYWORD_
				desc ="Search mySimon.com";
				url = "http://mysimon.search.com.com/search?pgtpid=4012&tag=mysfd.srch&qt=" + query;
				example = SWITCH_CODE + "mysimon half life";
				serviceHome = "http://www.mysimon.com/";
				break;
			// W3
			case "w3":
				desc = "Search W3.org (World Wide Web Consortium)";
				url = "http://www.google.com/custom?q=" + query + "&sa=Go&cof=T%3Ablack%3BLW%3A72%3BALC%3A%23ff3300%3BL%3Ahttp%3A%2F%2Fwww.w3.org%2FIcons%2Fw3c_home%3BLC%3A%23000099%3BLH%3A48%3BBGC%3Awhite%3BAH%3Aleft%3BVLC%3A%23660066%3BGL%3A0%3BAWFID%3A0b9847e42caf283e%3B&sitesearch=www.w3.org&domains=www.w3.org";
				serviceHome = "http://w3.org";
				break;
			// Movies and Showtimes
			case "rt":
				desc = "Search Rotten Tomatoes (Movies, Reviews and Previews)";
				url = "http://www.rottentomatoes.com/search/full_search.php?search=" + query;
				serviceHome = "http://www.rottentomatoes.com";
				break;
			case "imdb":
				desc = "Search The Internet Movie Database (IMDb)";
				url = "http://www.imdb.com/find?q=" + query;
				serviceHome = "http://www.imdb.com";
				break;
			// Slashdot related
			case "slashdot":
				desc = "Search Slashdot (/.)";
				url = "http://slashdot.org/search.pl?query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "/.":
				desc = "Search Slashdot (/.)";
				url = "http://slashdot.org/search.pl?query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "askslashdot":
				desc = "Ask Slashdot (/.)";
				url = "http://slashdot.org/search.pl?tid=4&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "ask/.":
				desc = "Ask Slashdot (/.)";
				url = "http://slashdot.org/search.pl?tid=4&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "slashdotbooks":
				desc = "Search Slashdot (/.) Books";
				url = "http://slashdot.org/search.pl?tid=6&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
		  case "digg":
				desc = "Search Digg.com";
				url = "http://digg.com/search?section=all&s=" + query;
				serviceHome = "http://digg.com";
				break;	
			case "/.books":
				desc = "Search Slashdot (/.) Books";
				url = "http://slashdot.org/search.pl?tid=6&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "slashdotpolls":
				desc = "Search Slashdot (/.) Polls";
				url = "http://slashdot.org/search.pl?op=polls&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "/.polls":
				desc = "Search Slashdot (/.) Polls";
				url = "http://slashdot.org/search.pl?op=polls&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "slashdotjournals":
				desc = "Search Slashdot (/.) Journals";
				url = "http://slashdot.org/search.pl?op=journals&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			case "/.journals":
				desc = "Search Slashdot (/.) Journals";
				url = "http://slashdot.org/search.pl?op=journals&query=" + query;
				serviceHome = "http://slashdot.org";
				break;
			// GNU
			case "gnu":
				desc = "Search GNU (GNU's Not UNIX!) - Gnu.org";
				url = "http://www.google.com/search?q=site%3Agnu.org+" + query;
				serviceHome = "http://gnu.org";
				break;
			// Programming Languages
			// Java
			case "java":
				desc = "Search Java Technology (Sun Developer's Site)";
				url = "http://onesearch.sun.com/search/developers/index.jsp?charset=utf-8&qt=" + query;
				serviceHome = "http://java.sun.com";
				break;
			case "cpan":
			case "perl":
				desc = "Search CPAN (Comprehensive Perl Archive Network)";
				url = "http://www.google.com/search?q=site:cpan.org+" + query;
				serviceHome = "http://www.cpan.org";
				break;
			case "python":
				desc = "Search Python.org";
				url = "http://www.google.com/search?sitesearch=python.org&domains=www.python.org&q=" + query;
				serviceHome = "http://www.python.org";
				break;
			case "msdn":
				desc = "Microsoft&reg; Developer Network (MSDN) Search";
				url = "http://search.microsoft.com/search/results.aspx?qu=" + query + "&View=msdn&st=b&c=0&s=1&swc=0";
				serviceHome = "http://msdn.microsoft.com";
				break;
			case "oreilly":
				desc = " Search O'Reilly.com";
				url = "http://catsearch.atomz.com/search/catsearch/?sp-a=sp1000a5a9&sp-f=ISO-8859-1&sp-t=cat_search&sp-q=" + query;
				serviceHome = "http://www.oreilly.com";
				break;
			// E-Bay
			case "ebay":
				desc = "Search eBay";
				url = "http://search.ebay.com/" + escape(query) + "_W0QQsokeywordredirectZ1QQfromZR8";
				serviceHome = "http://www.ebay.com";
				break;
			// Stock Quote
			case "quote":
			case "stockquote":
				desc = "Get Stock Quote";
				url = "http://finance.yahoo.com/q?s=" + query;
				serviceHome = "http://finance.yahoo.com";
				break;
			// MathWorld
			case "math":
			case "mathworld":
				desc = "Search Wolfram MathWorld (Mathematics Resource)";
				url = "http://mathworld.wolfram.com/search/?query=" + query;
				serviceHome = "http://mathworld.wolfram.com";
				break;
			case "drmath":
			case "mathforum":
				desc = "Search Math Forum - Ask Dr. Math";
				url = "http://www.google.com/search?q=site:mathforum.org+" + query;
				serviceHome = "http://www.mathforum.org";
				break;
			// Wikipedia
			case "wp":
			case "wikipedia":
			case "encyclopedia":
				desc = "Search Wikipedia (Free Encyclopedia)";
				url = "http://en.wikipedia.org/wiki/Special:Search?search=" + query + "&go=Go";
				serviceHome = "http://en.wikipedia.org";
				break;
			case "loc":
				desc = "Search The Library of Congress";
				url = "http://search.loc.gov:8765/query.html?qt=" + query + "&x=0&y=0";
				tip = "Use " + SWITCH_CODE + "locc To Search Only The Library of Congress Collections";
				usage = SWITCH_CODE + "loc " + "Immigration History";
				serviceHome = "http://www.loc.gov";
				break;
			case "locc":
				desc = "Search The Library of Congress Collections";
				url = "http://www.google.com/search?q=site:memory.loc.gov+" + query;
				serviceHome = "http://www.loc.gov";
				break;
			// Health
			case "health":
			case "webmd":			
				desc = "Search WebMD";
				url = "http://my.webmd.com/search/search_results/?query=" + query;
				serviceHome = "http://www.webmd.com";
				break;
			// Discovery
			case "discovery":
				desc = "Search Discovery.com";
				url = "http://search.discovery.com/search?q=" + query + "&restrict=wwwContent&proxystylesheet=http://www.discovery.com/search/xstylesheets/inclusive.xsl&num=100&site=dcom&client=dcom&output=xml_no_dtd&getfields=*&filter=1&through=dcom|searchbox";
				serviceHome = "http://www.discovery.com";
				break;
			case "nationalgeographic":
			case "ng":
				desc = "Search NationalGeographic.com";
				url = "http://google.nationalgeographic.com/search?site=default_collection&output=xml_no_dtd&client=default_frontend&proxystylesheet=default_frontend&oe=UTF-8&q=" + query;
				serviceHome = "http://www.nationalgeographic.com";
				break;
			// Lonely Planet
			case "travel":
			case "lonelyplanet":
			case "lp":
				desc = "Search Travel Pages";
				url = "http://search.lonelyplanet.com/query.html?rq=0&col=full&qt=" + query;
				serviceHome = "http://www.lonelyplanet.com";
				break;
			// Real-time Traffic
			case "traffic":
				desc = "Get Real Time Traffic Information";
				url = "http://maps.yahoo.com/maps_result?csz=" + query + "&zoomin=yes&BFKey=&mag=4&resize=l&cat=&trf=1#mapcontent";
				usage = SWITCH_CODE + "traffic [city], [state]";
				example = SWITCH_CODE + "traffic St. Paul, MN";
				tip = "State is optional";
				serviceHome = "http://maps.yahoo.com";
				break;
			// Maps
			case "map":
			case "maps":
				desc = "Search Google Maps/Local";
				var fields = query.split("/");
				url = "http://maps.google.com/maps?q=" + query;
				usage = SWITCH_CODE + "maps [street|city|state|zip|location]";
				example = SWITCH_CODE + "maps sfo *OR* " + SWITCH_CODE + "maps Minneapolis";
				tip = "Use " + SWITCH_CODE + "mapquest to use Mapquest Maps.";
				serviceHome = "http://maps.google.com";
				break;
			case "mapquest":
				desc = "Map It! - Maqpuest";
				var fields = query.split("/");
				url = "http://www.mapquest.com/maps/map.adp?country=US&";
				// url = "http://host.maptuit.com/maps.com/index.cgi?AddrPickBest=1";
				if(fields[0]) {
					// url += "&Address=" + fields[0];
					url += "&address=" + fields[0];
				}
				else {
					// url += "&Address=";
					url += "&address=";
				}
				if(fields[1]) {
					// url += "&City=" + fields[1];
					url += "&city=" + fields[1];
				}
				else {
					// url += "&City=";
					url += "&city=";
				}
				if(fields[2]) {
					// url += "&Region=" + fields[2];
					url += "&state=" + fields[2];
				}
				else {
					// url += "&Region=";
					url += "&state=";
				}
				if(fields[3]) {
					// url += "&Postal=" + fields[3];
					url += "&zipcode=" + fields[3];
				}
				else {
					// url += "&Postal=";
					url += "&zipcode=";
				}
				usage = SWITCH_CODE + "map [street] / [city] / [state] / [zip]";
				example = SWITCH_CODE + "map 316 4th Street SE/Minneapolis/MN/55414 *OR* -map /Minneapolis/MN";
				tip =  "Use " + SWITCH_CODE + "map to use Yahoo! Maps.";
				serviceHome = "http://www.mapquest.com";
				break;
			// Recipes - recipesource.com - Uses Google Site Search
			case "recipe":
			case "recipes":
				desc = "Search Recipes";
				url = "http://www.google.com/search?q=site%3Arecipesource.com%20" + query;
				serviceHome = "http://www.recipesource.com";
				break;
			// Lyrics
			case "ly":
			case "lyrics":
				desc = "Search Lyrics";
				var regEx =  / /g;
            url = "http://www.lyricsfreak.com/search.php?sa=GO&type=lyric&q=" + query.replace(regEx, "+");
				serviceHome = "http://www.astraweb.com";
				break;
			case "carols":
				desc = "Search Christmas Carols";
				url = "http://www.google.com/search?q=site:www.christmas-carols.net+" + query;
				serviceHome = "http://www.christmas-carols.net";
				break;
			case "hindily":
			case "hindilyrics":
				desc = "Search Hindi Lyrics";
				var regEx =  / /g;
				url = "http://www.hindilyrix.com/search/search.cgi?Terms=" + query.replace(regEx, "+");
				serviceHome = "http://www.hindilyrix.com";
				break;
			// Magazines
			case "wired":
				desc = "Search Wired News - Wired.com";
				url = "http://search.wired.com/wnews/default.asp?query=" + query;
				serviceHome = "http://www.wired.com";
				break;
			case "pcmag":
				desc = "Search PC Magazine - pcmag.com";
				url = "http://www.pcmag.com/search_results/0%2C2426%2C%2C00.asp?qry=" + query;
				serviceHome = "http://www.pcmag.com";
				break;
			case "pcworld":
				desc = "Search PC World - PCWorld.com";
				url = "http://search.pcworld.com/query.html?col=all&inthe=315360000&ws=0&nh=10&rf=0&lk=1&qm=0&st=1&rq=0&ql=a&si=0&dt=an&ht=0&la=en&fl0=&op0=&qt=" + query;
				serviceHome = "http://www.pcworld.com";
				break;
			case "fortune":
				desc = "Search Fortune Magazine - Fortune.com";
				url = "http://www.fortune.com/fortune/search?query=" + query + "&publication_id=6";
				serviceHome = "http://www.fortune.com";
				break;
			case "forbes":
				desc = "Search Forbes Magazine - Forbes.com";
				url = "http://www.forbes.com/search/results.jhtml?MT=" + query + "&sort=&aname=&author=&date=&pub=forbes.com%2Cmagazine%2Cglobal%2Cfyi%2Casap%2Cbest%2Cbow%2Cap%2Cpinnacor";
				serviceHome = "http://www.forbes.com";
				break;
			// Mozilla
			case "mozilla":
				desc = "Search Mozilla.org";
				url = "http://www.google.com/custom?domains=mozilla.org&sitesearch=mozilla.org&q=" + query;
				tip = "Use " + SWITCH_CODE + "mzine to search Mozillazine.org";
				serviceHome = "http://www.mozilla.org";
				break;
			case "mzine":
				desc = "Search Mozillazine.org";
				url = "http://www.google.com/custom?domains=mozillazine.org&sitesearch=mozillazine.org&q=" + query;
				serviceHome = "http://www.mozillazine.org";
				break;
			// CIA World Factbook
			case "country":
				desc = "From The CIA World Factbook";
				url = "http://www.google.com/search?hl=en&q=site%3Acia.gov+" + query + "&btnI=" + escape("I\"m Feeling Lucky");
				serviceHome = "http://www.cia.gov";
				break;
			// Date, Time, Sun rise/set, Dial Codes
			case "time":
				desc = "Get Current Time";
				var regEx =  / /g;
				url = "http://www.timeanddate.com/search/results.html?query=" + query;
				serviceHome = "http://www.timeanddate.com";
				break;
			case "dial":
				desc = "Get Dial Codes";
				var regEx =  / /g;
				url = "http://www.timeanddate.com/search/results.html?query=" + query;
				serviceHome = "http://www.timeanddate.com";
				break;
			case "latlon":
				desc = "Get Latitude and Longitude";
				var regEx =  / /g;
				url = "http://www.timeanddate.com/search/results.html?query=" + query;
				serviceHome = "http://www.timeanddate.com";
				break;
			case "sunrise":
			case "sunset":
			case "sunriseset":
				desc = "Get Sun Rise/Set Times";
				var regEx =  / /g;
				url = "http://www.timeanddate.com/search/results.html?query=" + query;
				serviceHome = "http://www.timeanddate.com";
				break;
			case "blogs":
			case "feedster":
				desc = "Search Blogs (Weblogs) - Feedster.com";
				url = "http://www.feedster.com/search.php?q=" + query;
				serviceHome = "http://www.feedster.com";
				tip = "Use " + SWITCH_CODE + "technorati to search Technorati.com";
				break;
			case "technorati":
				desc = "Search Technorati.com";
				url = "http://www.technorati.com/cosmos/search.html?rank=&url=" + query;
				serviceHome = "http://www.technorati.com";
				break;
			case "blogdex":
				desc = "Search Blogdex";
				url = "http://blogdex.net/search.asp?q=" + query + "&idx=description";
				serviceHome = "http://blogdex.net";
				break;
			case "daypop":
				desc = "Search Daypop";
				url = "http://www.daypop.com/search?search=Search&t=a&q=" + query;
				serviceHome = "http://www.daypop.com";
				break;
			case "trace":
				desc = "Trace Tool";
				url = "http://network-tools.com/default.asp?prog=trace&host=" + query;
				usage = SWITCH_CODE + "trace dynamicphilosophy.com"
				serviceHome = "http://network-tools.com";
				break;
			case "reversedns":   // Example: traceroute Canada
				desc = "The Reverse DNS For An IP Address";
				url = "http://www.lookupserver.com/index.php?submit=Lookup&reverse_dns=" + query;
				usage = SWITCH_CODE + "reversedns 64.233.187.99"
				serviceHome = "http://lookupserver.com";
				break;
			case "ping":
				desc = "Ping Tool";
				url = "http://network-tools.com/default.asp?prog=ping&host=" + query;
				usage = SWITCH_CODE + "ping dynamicphilosophy.com"
				serviceHome = "http://network-tools.com";
				break;
			case "dns":
			case "lookup":
				desc = "Lookup Tool";
				url = "http://network-tools.com/default.asp?prog=lookup&host=" + query;
				usage = SWITCH_CODE + "lookup dynamicphilosophy.com"
				serviceHome = "http://network-tools.com";
				break;
			case "whois":
				desc = "Whois Tool";
				url = "http://network-tools.com/default.asp?prog=whois&host=" + query;
				usage = SWITCH_CODE + "whois dynamicphilosophy.com"
				serviceHome = "http://network-tools.com";
				break;
			case "spam":
				desc = "Spam Database Lookup";
				url = "http://www.dnsstuff.com/tools/ip4r.ch?ip=" + query;
				usage = SWITCH_CODE + "spam" + " [IP Address]";
				serviceHome = "http://www.dnsstuff.com";
				break;
			case "dnsbl":
				desc = "Multi DNSBL Lookup";
				query = query.replace(/\./g, "/");
				url = "http://openrbl.org/ip/" + query + ".htm";
				usage = SWITCH_CODE + "dnsbl" + " [IP Address]";
				serviceHome = "http://www.openrbl.org";
				break;
			case "testemail":
				desc = "Test Valid E-Mail";
				url = "http://www.dnsstuff.com/tools/mail.ch?domain=" + query;
				serviceHome = "http://www.dnsstuff.com";
				break;
			// SHOP
			case "bb":
			case "bestbuy":
				desc = "Search BestBuy.com";
				url = "http://www.bestbuy.com/site/olspage.jsp?_dyncharset=ISO-8859-1&id=pcat17071&type=page&sc=Global&cp=1&nrp=15&sp=&qp=&list=n&iht=y&usc=All+Categories&ks=960&st=" + query;
				tip = "Use " + SWITCH_CODE + "bbg to search BestBuy.com using Google's Site Search";
            example = SWITCH_CODE + "bestbuy cable modem";
            serviceHome = "http://www.bestbuy.com";
				break;
			case "bbg":
			case "bestbuyg":
				desc = "Search BestBuy.com Using Google's Site Search";
				url = "http://www.google.com/search?q=site:bestbuy.com%20" + query;
            tip = "Use " + SWITCH_CODE + "bb to search BestBuy.com using their search engine";
            serviceHome = "http://www.bestbuy.com";
				break;
         case "circuitcity":
         case "ccity":
            desc = "Search CircuitCity.com";
            url = "http://www.circuitcity.com/ccd/Search.do?c=1&searchSection=All&go.x=0&go.y=0&keyword=" + query;
            tip = "Use " + SWITCH_CODE + "bb to search BestBuy.com";
            example = SWITCH_CODE + "circuitcity cable modem";
            serviceHome = "http://www.circuitcity.com";
            break;

			// Blogger

			// EVENTUALLY: ping, reverse dns should be on our server! - maybe? load handling/
			// Look ... more...http://www.dnsstuff.com/
			// Blogger, Google Local, Catalogs, Froogle, ... Look Firefox Google Bar
			// Google Sets
			// Maps - User enters maps, new box pops up - asks city state country...
			// Convert Currencies - http://finance.yahoo.com/currency/convert?amt=1&from=USD&to=GBP&submit=Convert
			// U.S. Box Office, India Bollywood Box Office
			// RSS, ATOM ...
			// Moviefone
			// State searches - MN, CA, NY, ... .gov or .us websites
			// U.S. patent, UK patent
			// Airports
			// Reverse DNS - Ip Address to Domain Name
			// Check http://www.lib.umn.edu/page.phtml?page_id=686
			// escape-unescape text in box
			default:
				document.getElementById("SearchBox").style.color = "#303030";
				// **HERE THERE WILL BE USER DEFINED QUERIES/BOOKMARKS**

				desc = "Google Search";
				if(multipleCodes == "true") {
					url = "http://www.google.com/search?q=" + query;
				}
				else {
					// Note: It is important to add the Code, which we previously stripped!
					url = "http://www.google.com/search?q=" + SWITCH_CODE + inputStr;
				}
				break;
		}
		if(multipleCodes == "true" && isKeyDown == 1) {
			window.open(url , '', 'width=600,height=600,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,directories=yes');
		}
	}
	var matchDetails = new Array(6);
	matchDetails[0] = url;
	matchDetails[1] = desc;
	matchDetails[2] = usage;
	matchDetails[3] = example;
	matchDetails[4] = tip;
	matchDetails[5] = serviceHome;
	matchDetails[6] = sensitive;

	return matchDetails;
}

function browser() {
	alert(navigator.userAgent.toLowerCase());
}
//--><!]]>
</script>

<style type="text/css">
/* General XHTML Tags */
body {color: #505050; font-family: Arial, sans-serif; font-size: 85%;}
a:link {color: #505050;}
a:visited {color: #505050;}
a:hover {text-decoration: none; color: #000000;}
a#HistoryLink  {}
a#HistoryLink:hover  {}
a#RecommendationsLink  {}
a#RecommendationsLink:hover  {}
a#CopyrightLink  {}
a#CopyrightLink:hover {cursor: help;}
a #ClearAll{color: #000000; padding: 3px;}
a:link.RedFont {color: #A52A2A;}
a:visited.RedFont {color: #A52A2A;}
a:link.GreenFont {color: #006600;}
a:visited.GreenFont {color: #006600;}
p {padding: 0px; margin: 0px;}
ol {padding: 0px; margin: 0px;}

/* Top Non-Visible Spacer*/
div.TopSpacer {position: relative; height: 130px;}

/* The Box and Recent Message Space*/
div.InputSpace {text-align: center;}
div.RecentMessagesSpace {position: relative; display: none; visibility: hidden; font-size: 91%; background: #FFF0F5; border: thin solid #D8D8D8; width: 40%; margin: 10px auto 10px auto; text-align: center; /*mozilla only css features now.*/ -moz-border-radius: 4px;}

div.CenterBox {position: relative; display: block; width: 40%; background: #F0FFFF; color: #F0FFFF; border-left: 1px solid #D8D8D8; border-top: 1px solid #D8D8D8; border-right: 2px solid #A0A0A0; border-bottom: 2px solid #A0A0A0; padding: 0px 0px 0px 0px; margin: 0px auto 0px auto; /*mozilla only css features now.*/ -moz-border-radius: 6px;}
form#SearchForm {position: relative; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;}
input.SearchBox {position: relative; width: 91%; font-weight: bold; border-style: solid; border-color: #C0C0C0; border-width: 1px; background: #FFFFFF; color: #303030; margin: 30px -4px 30px 0;}

/* Info Space and Service Description */
div.InfoSpace {text-align: center; font-size: 95%;}
div.ServiceDescription {position: relative; display: block; color: #383838; margin: 2px auto 2px auto; padding: 5px 0px 5px 0px;}

/* Help and Tip Section */
div.HelpAndTipSection {position: relative; display: none; color: #696969; margin: 0 auto 5px auto;}

/* Bottom Bar */
div.BottomBar {position: relative; display: block; margin: 0 auto 0 auto; width: 50%; overflow: hidden; padding-top: 5px; font-size: 91%;}
div.History {position: relative; border: thin solid #D8D8D8; display: none; visibility: hidden; overflow: hidden; margin: 0 auto 0 auto;}
div.Recommendations {position: relative; background: #F8F8F8; border: thin solid #D8D8D8; display: none; visibility: hidden; margin: 0 auto 0 auto; overflow: hidden;}
div.Bookmarks {position: relative; border: thin solid #D8D8D8; display: none; visibility: hidden; overflow: hidden; margin: 0 auto 0 auto;}
div.Copyright {position: relative; background: #F8F8F8; border: thin solid #D8D8D8; display: none; visibility: hidden; margin: 0 auto 0 auto;}

/* Clear History Link */
div.TopRightCorner {position: absolute; right: 0px; top: 0px; background: #D8D8D8; padding: 1px; overflow: hidden; font-size: smaller;}

/* History/Recommendations Entries */
div.WhiteBG {background: #FFFFFF; color: #505050; padding: 1px;}
div.WhiteBG:hover {padding: 1px;}
div.AlternateColorBG {background: rgb(246,246,246); padding: 1px;}
div.AlternateColorBG:hover {padding: 1px;}

/* History Entry on a new Date Separator */
div.Rule {position: relative; display: block; background: #D8D8D8; padding: 1px; margin: 5px auto 5px auto;}

/* Tab Background */
div.LightGrayBG {background: #D8D8D8; padding: 3px;}

/* History Date Headers */
span.DateHeader {font-size: 125%; margin: 3px auto 0px auto; font-variant: small-caps; font-weight: bolder; background: #F8F8F8;}
</style>

</head>

<body onload="welcomeBack()">
	<div class="TopSpacer" id="TopSpacer"></div>
	<div class="InputSpace" id ="InputSpace">
		<div class="RecentMessagesSpace" id="RecentMessagesSpace"></div>
		<div class="CenterBox" id="CenterBox">
			<form action="" id="SearchForm" onsubmit="return processInput(true)">
				<p id="InputField">
				<input name="SearchBox" class="SearchBox" id="SearchBox" maxlength="100" onkeyup="processInput(false)"/>
				</p>
			</form>
		</div>
	</div>
	<div class="InfoSpace">
		<div class="ServiceDescription" id="ServiceDescription"></div>
		<div class="HelpAndTipSection" id="HelpAndTipSection"></div>

		<div class="BottomBar">
			<a id="HistoryLink" title="Show/Hide History" href="#" onclick='toggleHistory()'>History</a> |
			<a id="RecommendationsLink" title="Show/Hide Recommendations" href="#" onclick='toggleRecommendations()'>Recommendations</a> |
			<a id="BookmarksLink" title="Show/Hide Bookmarks" href="#" onclick='toggleBookmarks()'>Bookmarks</a> |
			<a id="CopyrightLink" title="Copyright Info." href="#" onclick="toggleCopyright()">&copy;</a>

			<div class="History" id="History"></div>
			<div class="Recommendations" id="Recommendations"></div>
			<div class="Bookmarks" id="Bookmarks"></div>
			<div class="Copyright" id="Copyright"></div>
		</div>
	</div>
	<!--<div class="BottomBar" id="BottomBar">
		<div class="BottomBarItem" id="Item1"><a href="javascript:browser()">Your Browser</a></div>
	</div>-->
</body>
</html>
